import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/4/15 10:41
 * Rational Arithmetic (20) 理性算术 对于两个有理数，你的任务是实现基本的算术，也就是说，计算它们的和，差，
 * 积和商
 */
public class Day36 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String num = scanner.nextLine();
            String[] nums = num.split("/");
            StringBuilder sb = new StringBuilder();
            sb.append(nums[0]+" ");
            String[] tem = nums[1].split(" ");
            sb.append(tem[0]+" ");
            sb.append(tem[1]+" ");
            sb.append(nums[2]+" ");
            num = sb.toString();
            nums = num.split(" ");
            Long long1  =  Long.parseLong(nums[0]);
            Long long2  =  Long.parseLong(nums[1]);
            Long long3  =  Long.parseLong(nums[2]);
            Long long4  =   Long.parseLong(nums[3]);
            Num num1 = new Num(long1,long2);
            Num num2 = new Num(long3,long4);
            Num.print(num1);
            System.out.print(" + ");
            Num.print(num2);
            System.out.print(" = ");
            Num.print(Num.add(num1,num2));
            System.out.println();Num.print(num1);
            System.out.print(" - ");
            Num.print(num2);
            System.out.print(" = ");
            Num.print(Num.sub(num1,num2));
            System.out.println();Num.print(num1);
            System.out.print(" * ");
            Num.print(num2);
            System.out.print(" = ");
            Num.print(Num.mul(num1,num2));
            System.out.println();Num.print(num1);
            System.out.print(" / ");
            Num.print(num2);
            System.out.print(" = ");
            if (num2.up==0){
                System.out.print("Inf");
            }else {
                Num.print(Num.div(num1,num2));
            }
            System.out.println();
        }
    }

}
class Num {
    Long up;
    Long down;

    public Num(Long up, Long down) {
        this.up = up;
        this.down = down;
    }

    public Num() {
    }

    public static Long gcd(Long num1, Long num2) {
        if (num2 == 0) {
            return num1;
        } else {
            return gcd(num2, num1 % num2);
        }
    }

    public static Num easy(Num num) {
        //分母非负
        if (num.down < 0) {
            num.up = -num.up;
            num.down = -num.down;
        }
        if (num.up == 0) {
            num.down = 1L;
        } else {
            Long d = gcd(Math.abs(num.up), Math.abs(num.down));
            num.down /= d;
            num.up /= d;
        }
        return num;
    }

    public static Num add(Num num1,Num num2) {
        Num num = new Num();
        num.up = num1.up* num2.down + num2.up* num1.down;
        num.down = num1.down* num2.down ;
        return num;
    }
    public static Num sub(Num num1,Num num2) {
        Num num = new Num();
        num.up = num1.up* num2.down - num2.up* num1.down;
        num.down = num1.down* num2.down ;
        return num;
    }
    public static Num mul(Num num1,Num num2) {
        Num num = new Num();
        num.up = num1.up*num2.up;
        num.down = num1.down* num2.down ;
        return num;
    }
    public static Num div(Num num1,Num num2) {
        Num num = new Num();
        num.up = num1.up* num2.down ;
        num.down = num1.down* num2.up ;
        return num;
    }
    public static void print(Num num){
        num = easy(num);
        if (num.up < 0){
            System.out.print("(");
        }
        if (num.down==1){
            System.out.print(num.up);
        }else if (Math.abs(num.up)> num.down){
            System.out.print(num.up/ num.down +" "+ Math.abs(num.up)% num.down+"/"+ num.down);
        }else {
            System.out.print(num.up+"/"+num.down);
        }
        if (num.up < 0){
            System.out.print(")");
        }
    }
}